﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Controller;

public partial class NewRelato : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string ClienteID = Request.QueryString["IDCliente"].ToString();
        cntrCliente objCntrCliente = new cntrCliente();
        DS_Lawyer.ClienteRow rowCliente = objCntrCliente.Select(ClienteID);

        lblNome.Text = rowCliente.nome;
        lblCPF.Text = rowCliente.cpf;

    }
    protected void btnSalvar_Click(object sender, EventArgs e)
    {
        try
        {
            DS_Lawyer.RelatoDataTable dtRelato = new DS_Lawyer.RelatoDataTable();
            DS_Lawyer.RelatoRow rowRelato = dtRelato.NewRelatoRow();

            rowRelato.idRelato = "";
            rowRelato.descricao = txtDescricao.Text;
            rowRelato.dataCadastro = System.DateTime.Now;
            rowRelato.idCliente = Request.QueryString["IDCliente"].ToString();
            rowRelato.assunto = txtAssunto.Text.Trim();

            cntrRelato objCntrRelato = new cntrRelato();
            objCntrRelato.Save(rowRelato);
            txtDescricao.Text = "";

            string link = "Cliente.aspx";
            Response.Redirect(link);

        }
        catch (Exception ex)
        {

            throw (new Exception(ex.Message));
        }
    }
}
